WITH Ada.Text_IO;
WITH Note.Composants;

PACKAGE BODY Matiere.Composants IS

   FUNCTION GetCoefficient (maMatiere : IN Matiere) return Coefficient IS
   BEGIN
      Return maMatiere.Un_Coefficient;
   END GetCoefficient;


   FUNCTION GetIntitule (maMatiere : IN Matiere) return String IS
   BEGIN
      Return maMatiere.Un_Intitule;
   END GetIntitule;


   FUNCTION GetNote (maMatiere : IN Matiere) return Note.Note IS
   BEGIN
      Return maMatiere.Une_Note;
   END GetNote;


   FUNCTION GetValeurNote (maMatiere : IN Matiere) return Valeur.Valeur IS
   BEGIN
      Return Note.Composants.GetValeur(maMatiere.Une_Note);
   END GetValeurNote;


   PROCEDURE ModifierNoteMatiere (maMatiere : IN OUT Matiere) IS
   BEGIN
      maMatiere.Une_Note := Note.Composants.ModifierNote(maMatiere.Une_Note);
   END ModIFierNoteMatiere;


   PROCEDURE Ponderer (maMatiere : IN OUT Matiere) IS
   BEGIN
      loop
         BEGIN
            Ada.Text_IO.Put_Line("Le coeffcient actuel est : "
                                 & Natural'Image(maMatiere.Un_Coefficient));

            Ada.Text_IO.Put_Line("Quel est le nouveau coefficient ? 1 <= x <= 8");
            maMatiere.Un_Coefficient := Coefficient'Value (Ada.Text_IO.Get_Line);
            exit;
         EXCEPTION
            WHEN others=>
               Ada.Text_IO.Put_Line("Erreur de coefficient");
         END;
      END loop;
   END Ponderer;

   FUNCTION Etat2Natural(maMatiere : IN Matiere) return Valeur.Etat2Natural IS
   BEGIN
      return Note.Composants.Etat2Natural(GetNote(maMatiere));
   END Etat2Natural;

END Matiere.composants;
